package com.lqm;


import com.lqm.dao.UserAddressDao;
import com.lqm.entity.home.HomeUser;
import com.lqm.service.home.HomeUserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;


/**
 * @program: CrowdFunding
 * @description
 * @author: lqm
 * @create: 2018-12-09 15:39
 */
@RunWith(SpringRunner.class)
@SpringBootTest
public class InsertData {
    @Autowired
    HomeUserService homeUserService;
    @Autowired
    UserAddressDao userAddressDao;

    @Test
    public void t() {



        for (int i = 0; i < 10; i++) {
  /*          HashSet<UserAddress> set = new HashSet<>();
            UserAddress address = new UserAddress();
            address.setAddressName("地址"+i);
            set.add(address);*/
            HomeUser user = new HomeUser();
            user.setUsername("用户-" + i);
            user.setPassword("admin" + i);
            user.setSex("男");
            user.setIp("192.168.1." + i);
            user.setStatus(1);
            user.setUserPhone("1887754388" + i);
            user.setUserImg("/img/" + i + ".jpg");
            user.setUserEmail("admin" + i + "@qq.com");
            user.setUserNick("用户昵称-" + i);
//            user.setUserAddresses(set);
            homeUserService.save(user);
        }

//        address.setHomeUser();
//        userAddressDao.save();



    }
}
